package jdbc;

import java.nio.ByteBuffer;
import java.util.List;
import java.util.Random;

import cn.edu.thu.laud.lasql.function.iface.LaSQLLocalFunction;

public class FeatureFunction implements LaSQLLocalFunction{
	public  byte[] createImageFeature(){
		ByteBuffer buffer=ByteBuffer.allocate(Double.SIZE*144);
		Random random=new Random(System.currentTimeMillis());
		for(int i=0;i<144;i++){
			buffer.putDouble(random.nextDouble()*8);
		}	
		byte[] bytes=new byte[1152];
		buffer.position(0);
		for(int i=0;i<1152;i++){
			bytes[i]=buffer.get();
		}
		return bytes;
	}

	@Override
	public ByteBuffer executeLocal(List<String> params) throws Exception {
		return ByteBuffer.wrap(createImageFeature());
	}
}
